<%@ page import="org.apache.commons.lang.StringUtils" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/common/taglib.jsp" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<%
    String frame = request.getParameter("frame");

    String forwardUrl =  request.getHeader("referer");

    if (StringUtils.isEmpty(forwardUrl)) {
        forwardUrl = request.getContextPath() + "/index.do";
    }
    pageContext.setAttribute("frame", frame);
    pageContext.setAttribute("forwardUrl", forwardUrl);
%>
<html>
<head>

    <title>51void论坛- Powered by 51forum</title>
    <style type="text/css">
        body {
            margin: 0px;
        }

        #frameswitch {
            background: url( '${ctx}/imgs/frame_switch.gif' ) no-repeat 0;
            cursor: pointer;
        }
    </style>
    <script type="text/javascript">
        function framebutton() {
            var obj = document.getElementById('navigation');
            var frameswitch = document.getElementById('frameswitch');
            var switchbar = document.getElementById('switchbar');
            if (obj.style.display == 'none') {
                obj.style.display = '';
                switchbar.style.left = '177px';
                frameswitch.style.backgroundPosition = '0';
            } else {
                obj.style.display = 'none';
                switchbar.style.left = '0px';
                frameswitch.style.backgroundPosition = '-11';
            }
        }

        if (top != self) {
            top.location = self.location;
        }

    </script>
</head>


<body scroll="no">

<c:choose>
    <c:when test="${frame eq 'no'}">
        <%
            response.sendRedirect(forwardUrl);
        %>
    </c:when>
    <c:otherwise>
        <table border="0" cellPadding="0" cellSpacing="0" height="100%" width="100%">
            <tr>
                <td align="middle" id="navigation" valign="center" name="frametitle" width="180">
                    <iframe name="leftmenu" frameborder="0" src="${ctx}/leftMenu.do?frame=<%=frame%>" scrolling="no"
                            style="height: 100%; visibility: inherit; width: 180px; z-index: 1"
                            onkeydown="refreshrightframe(event)"></iframe>
                </td>
                <td style="width: 100%">
                    <table id="switchbar" border="0" cellPadding="0" cellSpacing="0" width="11" height="100%"
                           style="position: absolute; left: 177px; background-repeat: repeat-y; background-position: -177px">
                        <tr>
                            <td onclick="framebutton()"><img id="frameswitch" src="${ctx}/imgs/none.gif" alt=""
                                                             border="0" width="11" height="49"/></td>
                        </tr>
                    </table>
                    <iframe frameborder="0" scrolling="yes" name="main" src="${forwardUrl}"
                            style="height: 100%; visibility: inherit; width: 100%; z-index: 1;overflow: auto;"
                            onkeydown="refreshrightframe(event)"></iframe>
                </td>
            </tr>
        </table>
    </c:otherwise>
</c:choose>
 <script type="text/javascript">
        if (window.location.hash) {
            var hashs=unescape(window.location.hash);
//            alert(unescape(window.location.hash));
            main.location = hashs.replace('#', '');
        }
    </script>
</body>
</html>
